<%-- 
    Document   : departmentsList
    Created on : Oct 17, 2012, 9:15:38 AM
    Author     : DinhThang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Departments List</title>
            <link rel="stylesheet" type="text/css" href="../styles/style.css" />
        </head>
        <body>        
            <jsp:include page="../includes/incHeader.jsp" flush="false" />
            <h3>Departments List</h3>
            <h:form>
                <center>
                    <h:commandLink value="Add New" action="articlesAdd"/></center><br/>
                    <h:messages/>
                    <h:dataTable style="margin:0 auto; border:1px solid #999; width:60%" value="#{articlesBean.articlesList}" var="article" rendered="#{not empty departmentsBean.deparList}">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Title"/>
                            </f:facet>
                            <h:outputText value="#{article.title}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Creater"/>
                            </f:facet>
                            <h:outputText value="#{article.userCreate}">
                                <f:convertDateTime type="date" dateStyle="medium" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Create Time"/>
                            </f:facet>
                            <h:outputText value="#{article.createTime}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="IsEnable"/>
                            </f:facet>
                            <h:outputText value="#{article.isEnable}"/>
                        </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Delete"/>
                        </f:facet>
                        <h:commandLink value="Del" action="#{articlesBean.prepareData4Delete}">
                            <f:param name="idParam" value="#{article.articleID}"/>
                        </h:commandLink>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Update"/>
                        </f:facet>
                        <h:commandLink value="Edit" action="#{articlesBean.prepareData4Update}">
                            <f:param name="idParam" value="#{article.articleID}"/>
                        </h:commandLink>
                    </h:column>
                </h:dataTable>
                    <br />
                <center>
                    <t:dataList value="#{articlesBean.pages}" var="page">
                        <h:commandLink value="#{page}" actionListener="#{articlesBean.page}"
                                       rendered="#{page != articlesBean.currentPage}" />
                        <h:outputText value="<b>#{page}</b>" escape="false"
                                      rendered="#{page == articlesBean.currentPage}" />
                    </t:dataList><br />
                    <h:outputText value="[Page: #{articlesBean.currentPage} / #{articlesBean.totalPages}]" /></center>
                </h:form>

            <jsp:include page="../includes/incFooter.jsp" flush="false" />
        </body>
    </html> </f:view>


